import type {ExtractPropTypes, PropType} from 'vue'
import {buildProps, type DevMethods} from "@/utils";


export const devCascaderProps = buildProps({
    // 接口地址
    api: {
        type: Function as PropType<(params?: any) => Promise<any>>,
        default: () => {
            return () => Promise.resolve({}); // 默认返回空 Promise，防止报错
        }
    },
    // 是否使用接口
    useApi: {
        type: Boolean,
        default: false
    },
    // 接口请求携带的参数
    apiParams: {
        type: Object as PropType<any>,
        default: () => {
            return {};
        }
    },
    // 是否需要处理获取数据路径
    isDataProcessed: {
        type: Boolean,
        default: false
    },
    // 是否在vue3 onMounted生命周期中调用
    onMounted: {
        type: Boolean,
        default: true
    },
    // 是否在vue3 onActivated生命周期中调用
    onActivated: {
        type: Boolean,
        default: false
    },
    // 绑定的数据
    devCascaderFieldsFn: {
        type: Function as PropType<DevMethods['devCascaderFieldsFn']>,
    }
} as const)
export type DevCascaderProps = ExtractPropTypes<typeof devCascaderProps>
